const { convertBasicItems, filterItems, exportToCSV } = require('./convert-basic-items');

console.log('=== 基础物品数据转换工具 ===\n');

// 运行转换
try {
    const convertedData = convertBasicItems(
        './output/websocket_data_基础物品.json',
        './output/converted_basic_items.json'
    );

    // 导出CSV
    exportToCSV(convertedData, './output/basic_items.csv');

    // 显示一些示例数据
    console.log('\n=== 转换后的数据示例 ===');
    const sampleItems = Object.values(convertedData).slice(0, 3);
    sampleItems.forEach(item => {
        console.log(`\n物品: ${item.name}`);
        console.log(`  价格: ${item.properties.价格}`);
        console.log(`  等级: ${item.properties.等级}`);
        console.log(`  负重: ${item.properties.负重}`);
        console.log(`  介绍: ${item.properties.介绍}`);
    });

    console.log('\n✅ 转换完成！');

} catch (error) {
    console.error('❌ 转换失败:', error.message);
}

